#ifndef WEBGRAPH_H
#define WEBGRAPH_H

#include <QWebEngineView>

class WebGraphPrivate;
class WebGraph : public QWebEngineView
{
    Q_OBJECT
public:
    explicit WebGraph(QWidget* parent = nullptr);
    virtual ~WebGraph();

    void setTitle(const QString& title);
    QString title() const;

    void setTitleColor(const QColor& color);
    QColor titleColor() const;

    void addItem(const QString& type, const QString& name, const QList<double>& data);

    int count() const;
    void clear();
    void render();

protected:
    void mousePressEvent(QMouseEvent *);
    void mouseReleaseEvent(QMouseEvent *);
    void dragEnterEvent(QDragEnterEvent* e);
    void dragMoveEvent(QDragMoveEvent* e);
    void dropEvent(QDropEvent *event);
    virtual bool event(QEvent *e);
    virtual bool eventFilter(QObject *obj, QEvent *e);

private slots:
    void onMouseEvent(QMouseEvent* me);

private:
    WebGraphPrivate* d_ptr;
    Q_DISABLE_COPY(WebGraph)
};

#endif // WEBGRAPH_H
